import React, { Component } from 'react'
import style from "./askDetail.module.css"
import {withRouter}  from "react-router-dom"
import axios from 'axios'
 class askDetail extends Component {
     state={
         data:[]
     }
    componentDidMount() {
        this.bbb()
    }
    bbb() {
        let {id} =this.props.location.state
        const headerJSON = {
            "Content-Type": "application/json;charset=UTF-8"
        };
        axios({
            url: "/loupan/quiz/selectQuiz/",
            method: 'post',
            data: {
                
            },
            headers: headerJSON,
        }).then(res => {
            this.state.data= res.data[0]
            this.setState({
               id:id
            })
            console.log(this.state.data,"aaa")
        })

    }
    render() {
        // console.log(this.props.location.state,"aaa")
        return (
            <div>
               <div>
                   <div className={style.maincon}>
                <h2><span onClick={()=>{
                    this.props.history.push("./center/ask")
                }}>&lt;</span>资讯-问答详情</h2>
                <div className={style.title}>
                    <h3>{this.state.data.qask}</h3>
                   <div className={style.ask}> <span>楼盘咨询</span> <span>买房建议</span></div>
                </div>
                  <div className={style.consult}>
                    <div className={style.top}> 
                    <div className={style.pic}>
                    <img src={this.state.data.qimg}/>
                    </div>
                    <div className={style.info}>
                    <p>{this.state.data.qname}</p>
                    <span>2021-06-03</span>
                    </div>
                    <button>免费咨询</button>
                    </div>
                    <div className={style.comment}>
                        <p>本次评价为<span>精品回答</span></p>
                        <dl>{this.state.data.qdetails}</dl>
                        </div>
                  </div>
                
                   </div>
               </div>
            </div>
        )
    }
}
export default withRouter(askDetail)
